package com.jrx.anytxn.customer.service;

import com.jrx.anytxn.common.exception.TxnBizException;
import com.jrx.anytxn.common.exception.TxnException;
import com.jrx.anytxn.customer.dto.coupon.CouponReq;
import com.jrx.anytxn.customer.entity.CmCustomerRightInfo;
import com.jrx.anytxn.customer.entity.TlCouponDetail;
import com.jrx.anytxn.customer.entity.TlRightsExchangeLog;
import com.jrx.anytxn.feign.gateway.request.CouponRequest05;
import com.jrx.anytxn.feign.gateway.response.CouponResponse05;
import com.jrx.anytxn.param.dto.rights.CardCouponDetailRes;

import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * 优惠券导入接口
 */
public interface ICouponInputService {

    /**
     * 根据Map 组装文件入库
     * @param list
     */
    void couponInput(List<Map<String,Object>> list,String tenantId,String userName,String fileName) throws TxnException;

    /**
     * 权益（包含优惠券和权益资格）下发
     * @param couponReq 权益请求对象
     * @throws TxnException
     */
    List<TlCouponDetail> grantCoupon(CouponReq couponReq) throws TxnException;

    /**
     * 权益资格兑换
     */
    CmCustomerRightInfo exchangeQualification(CouponReq couponReq) throws TxnBizException;

    /**
     * 权益平台下单
     * @param req
     * @return
     */
    Optional<CouponResponse05> cardCouponCreateOrder(CouponRequest05 req);

    /**
     * 订单详情-卡密信息
     */
    CardCouponDetailRes cardCouponDetail(CouponReq couponReq) throws TxnException ;

    /**
     * 是否允许选择其他权益进行兑换
     * @param lastExchangeLog
     * @return
     */
    boolean couldChooseAnotherRights(TlRightsExchangeLog lastExchangeLog, String chosenRightsId);

}
